require 'View.Base.BehaviourView'
Expand = class("Expand", BehaviourView)

function Expand:Awake(obj)
    BehaviourView.Awake(self, obj)
    self.DESIGN_WIDTH = 1280
    self.DESIGN_HEIGHT = 720
    self.ratio = self.DESIGN_WIDTH/self.DESIGN_HEIGHT
    self:Update()
end

function Expand:Update()
    local ratio = UnityEngine.Screen.width / UnityEngine.Screen.height
    if ratio > self.ratio then
        local standWidth = UnityEngine.Screen.height * self.ratio;
        local scale = UnityEngine.Screen.width / standWidth;
        self.transform.localScale = Vector3(scale, 1, 1)
    else
        local standHeight = UnityEngine.Screen.width / self.ratio
        local scale =  standHeight/ UnityEngine.Screen.height
        self.transform.localScale = Vector3(1, 1, scale)
    end
end
